﻿namespace Devonline.Entity;

/// <summary>
/// 包装, 字符串表达式的默认实现
/// </summary>
[DisplayName("包装")]
public class PackageViewModel : PackageViewModel<string>, IViewModel, IEntitySet
{
    /// <summary>
    /// 通用附件集合, NotMapped Attachments 用于记录实体对象上上传的附件
    /// </summary>
    [NotMapped]
    public virtual ICollection<Attachment>? Attachments { get; set; }
}

/// <summary>
/// 包装
/// </summary>
/// <typeparam name="TKey"></typeparam>
[DisplayName("包装")]
public abstract class PackageViewModel<TKey> : ViewModel<TKey>, IViewModel<TKey>, IEntitySet<TKey> where TKey : IConvertible
{
    /// <summary>
    /// 名称
    /// </summary>
    [DisplayName("名称"), Excel]
    public virtual string Name { get; set; } = null!;
    /// <summary>
    /// 封面图
    /// </summary>
    [DisplayName("封面图"), Excel]
    public virtual string? Image { get; set; }
    /// <summary>
    /// 包装单位, 包装单位
    /// </summary>
    [DisplayName("包装单位"), DefaultValue(PackageUnit.BOX), Excel]
    public virtual PackageUnit Unit { get; set; }
    /// <summary>
    /// 货品类型
    /// </summary>
    [DisplayName("包装方式"), DefaultValue(PackageType.Box), Excel]
    public virtual PackageType Type { get; set; }
    /// <summary>
    /// 外观尺寸, 装箱规格, 装箱尺寸, 长宽高[+公差]+单位
    /// 表述形式: 长*宽*高[±公差]单位, 可以带单位, 也可以不带单位, 单位可以是 mm, cm, inch 等等, 也可以是 m, ft 等等, 也可以是个数等单位
    /// 如: 25*35*10±1 mm
    /// </summary>
    [DisplayName("尺寸"), Excel]
    public virtual string? Size { get; set; }
}
